package org.dromara.erp.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.tenant.core.TenantEntity;

import java.io.Serial;
import java.math.BigDecimal;

/**
 * 商品管理对象 erp_products
 *
 * @author Mr Lei
 * @date 2024-06-01
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("erp_products")
public class ErpProducts extends TenantEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(value = "id")
    @ExcelProperty(value = "id")
    private Long id;

    /**
     * 商品名称
     */
    @NotBlank(message = "产品名称不能为空", groups = {AddGroup.class, EditGroup.class})
    @ExcelProperty(value = "商品名称")
    private String name;

    /**
     * 默认单价
     */
    @ExcelProperty(value = "默认单价")
    private BigDecimal price;

    /**
     * 库存数量
     */
    @ExcelProperty(value = "库存数量")
    private BigDecimal stock;

    /**
     * 最新进价
     */
    @ExcelProperty(value = "最新进价")
    private BigDecimal newPrice;

    /**
     * 库存价
     */
    @ExcelProperty(value = "库存价")
    private BigDecimal oldPrice;

    /**
     * 单位
     */
    @NotNull(message = "包装单位不能为空", groups = {AddGroup.class, EditGroup.class})
    @ExcelProperty(value = "包装单位")
    private Long unitId;
    @TableField(exist = false)
    private String unitName;

    /**
     * 商品分类
     */
    @NotNull(message = "商品分类不能为空", groups = {AddGroup.class, EditGroup.class})
    @ExcelProperty(value = "商品分类")
    private Long cateId;
    @TableField(exist = false)
    private String cateName;

    /**
     * 描述
     */
    private String remark;

    /**
     * 产品状态
     */
    @ExcelProperty(value = "状态")
    private String status;

    /**
     * 排序
     */
    private Long sort;

    /**
     * 所属仓库
     */
    private Long warehouseId;
    @TableField(exist = false)
    private String warehouseName;
    /*图片URL */
    private String imgUrl;
    /*图片id */
    private String imgOssId;
    /*库存预警 */
    private Boolean inventoryWarning;

}
